package network;

/**
 * Les messages du serveur.
 * @author Guillaume Poças & Jean-François
 */
public enum KrakenServerMsg implements KrakenCommandMaker {
	KRAKEN_SERVER("KRAKEN_SERVER"),
	
	WAITING_FILE("WAITING_FILE"),
	END_WAITING_FILE("END_WAITING_FILE"),
	FILE_SAVED("FILE_SAVED"),
	FOLDER_CLEAN("FOLDER_CLEAN"),
	
	END_ENCRYPTION_DISTRIBUTION("END_ENCRYPTION_DISTRIBUTION"),
	PATH_ENCRYPTION_DISTRIBUTION("PATH_ENCRYPTION_DISTRIBUTION"),
	END_ENCRYPTION_PARAMETER("END_ENCRYPTION_PARAMETER"),
	PATH_ENCRYPTION_PARAMETER("PATH_ENCRYPTION_PARAMETER"),
	
	RSA_KEY_GENERATED("RSA_KEY_GENERATED"),
	KEY_GENERATED("KEY_GENERATED"),
	
	//utiles ?
	CONNECTION_ESTABLISHED("CONNECTION_ESTABLISHED"),
	CONNECTION_REFUSED("CONNECTION_REFUSED"),
	SERVER_FULL("SERVER_FULL"),
	
	END_SERVER("END_SERVER"),
	
	ERROR("ERROR"),
	UNKNOWN_COMMAND("UNKNOWN_COMMAND"),
	TIMEOUT("TIMEOUT"),
	
	// diffie-hellman protocole
	DH_ACK("DH_ACK"),
	RECEIVED_P("RECEIVED_P"),
	RECEIVED_G("RECEIVED_G"),
	SEND_B("SEND_B");
	
	public String msg;

	/**
	 * Constructeur.
	 * @param msg
	 */
	private KrakenServerMsg(String msg) {
		this.msg = msg;
	}

	@Override
	public String makeCommand(String... values) {
		StringBuilder sb = new StringBuilder(msg);
		if(values!=null){
			for(String v:values){
				sb.append(" "+v);
			}
		}
		return sb.toString();
	}
}
